package com.example.elastcisearch;

import lombok.SneakyThrows;
import org.junit.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class TestJdbc {
    
    @Test
    @SneakyThrows
    public void test() {
        Connection connection = DriverManager.getConnection("jdbc:es://http://192.168.228.104:9200");
        PreparedStatement statement = connection.prepareStatement("select * from tvs");
        ResultSet resultSet = statement.executeQuery();
        while (resultSet.next()) {
            System.out.println(resultSet.getString(1));
            System.out.println(resultSet.getString(2));
            System.out.println(resultSet.getDate(3));
            System.out.println(resultSet.getLong(4));
            System.out.println("===============");
        }
    }
}
